Skip to content

London|May 2025|Alexandru Pocovnicu|Coursework/sprint 3 #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

alexandru-pocovnicu
Copy link

@alexandru-pocovnicu alexandru-pocovnicu commented Jul 4, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@alexandru-pocovnicu alexandru-pocovnicu added the Needs Review Participant to add when requesting review label Jul 4, 2025
@alexandru-pocovnicu alexandru-pocovnicu changed the title Coursework/sprint 3 London|May 2025|Alexandru Pocovnicu|Coursework/sprint 3 Jul 5, 2025
@cjyuan cjyuan added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Participant to add when requesting review labels Jul 15, 2025
Comment on lines 46 to 51
test("should repeat the string count times", () => {
const str = "hello";
const count = -1;
const repeatedStr = repeat(str, count);
expect(repeatedStr).toEqual("negative number");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you modified repeat() to throw an error when count is negative, and you wanted to test if the function can throw an error as expected, you can use .toThrow(). You can find out more about how to use .toThrow() here: https://jestjs.io/docs/expect#tothrowerror (Note: Pay close attention to the syntax of the example)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you but I couldn't understand the documetation

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jul 15, 2025
@alexandru-pocovnicu
Copy link
Author

Hi, I don't know what's happening, all the files in sprint 3 from my computer are empty, as if i haven't done any work in them , is there a way I could copy the ones on github, should i clone the whole PR and then push that , will i have to create a new PR?
Thank you.

@alexandru-pocovnicu
Copy link
Author

never mind the previous message , sorted....i was in the wrong branch

@alexandru-pocovnicu alexandru-pocovnicu added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 17, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

I only have a few more suggestions. I will mark this PR as completed first.

Comment on lines +3 to +5
if (Math.abs(numerator) < Math.abs(denominator)) {
return true}else{
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you improve the indentation of this code?

This is the suggested style by CYF: https://curriculum.codeyourfuture.io/guides/reviewing/style-guide/

Comment on lines 5 to 8
const allrank=["2","3","4","5","6","7","8","9","10"]
if(allrank.includes(rank))return Number(rank);
if(rank==="10"|| rank==="J" || rank==="Q" || rank==="K") return 10;
else return "Invalid card rank"
else return "Invalid card rank";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have taken care of "10" at line 6, so you don't have to check for rank==="10" at line 7.

Comment on lines +35 to +41

test("should return invalid cards for anything else", () => {
expect(getCardValue("2.1♠")).toBe("Invalid card rank");
});
test("should return invalid cards for anything else", () => {
expect(getCardValue("00_02♠")).toBe("Invalid card rank");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could combine these into one tests, as both of them are testing for invalid card ranks.

@@ -1,8 +1,12 @@
function repeat(str,count) {
if(count<0){
return "negative number"
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly suggest looking up "How to throw error in JavaScript".

@@ -22,27 +22,32 @@ test("password has at least 5 characters", () => {
const result = isValidPassword(password);
// Assert
expect(result).toEqual(true);
expect(isValidPassword("12h")).toEqual(false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An string that contains all required characters except that it is too short would make a better test value because when the function return false, we would know exactly why it returns false.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants